package spring.model;

import java.util.HashMap;
import java.util.Map;

/**
 * 实例工厂方法：实例工厂方法需先创建工厂本身，在调用
 *
 * @author jiangbang
 * @date 2016/11/8
 */
public class InstanceCarFactory {

    private Map<String,Car> cars =null;

    public InstanceCarFactory(){
        cars =  new HashMap<>();
        cars.put("audi",new Car("audi","1"));
        cars.put("ford",new Car("ford","2"));
    }

    public  Car getCar(String name){
        return cars.get(name);
    }
}
